var roleMushi = {

    /** @param {Creep} creep **/
    run: function(creep) {
        creep.say('AFKclr III', true);

        if(!creep.pos.isEqualTo(Game.flags['Flag6'].pos)){
            creep.memory.building = true;
        }
        else{
            creep.memory.building = false;
        }

        if(creep.memory.building == true){
            creep.moveTo(Game.flags['Flag6'].pos);
        }
        else{
            const target = creep.pos.findClosestByRange(FIND_MY_CREEPS, {
                filter: function(object) {
                    return object.hits < object.hitsMax;
                }
            });
            if(target) {
                if(creep.heal(target) == ERR_NOT_IN_RANGE) {
                    creep.moveTo(target);
                }
            }
        }
	}
};

module.exports = roleMushi;